package hc.bre.runner

@groovy.transform.CompileStatic
class ShellApplyRunner extends RuleRunnerSupportEx {
	public Object run(Object namedArgsMap) {
		Binding binding = new Binding(namedArgsMap as Map)

		String scriptName = "${classFullName()}Caller.groovy";
		RuleGroovyShell shell = new RuleGroovyShell(binding,configuration(ruledir),scriptName)

		def ret = shell.evaluate("apply(${classFullName()}.rule)");
		
		return ret;
		
		
//		Binding binding = new Binding(namedArgsMap as Map)
//		binding.putAt('_entry_',rpath);
//		String clazzName = hc.Util.rpathPrjectCode(rpath) +'.Main'
//		String scriptName = "${clazzName}Caller.groovy";
//		RuleGroovyShell shell = new RuleGroovyShell(binding,configuration(classpath),scriptName)
//		def ret = shell.evaluate("apply(${clazzName}.rule)");
//		return ret;
	}
}
